home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
BASIC
/
2620C.ZIP
/
MAKE.ZIP
/
MAKE.BAS
< prev
Wrap
BASIC Source File
|
1990-09-16
|
7KB
|
197 lines
'############################################################################
'FILE: MAKE.BAS : This is the main file
'PURPOSE: UTILITY TO COMPILE ALL .PBU FILES THAT ARE NOT CURRENT
'WARNING: 1. THIS ASSUMES A FILE EXTENSION OF .BAS FOR ALL SOURCE
' FILES: THAT IS EASILY CHANGED BELOW, IF NEED BE.
' 2. THIS DOESN'T TRAP ERRORS OCCURRING DURING COMPILING.
' 3. ALL FILES MUST BE IN CURRENT DIRECTORY.
' 4. THIS UTILITY CREATES A BATCH FILE NAMED TMP-MKE.BAT,
' AND WILL OVERWRITE ANY OTHER FILE OF THAT NAME.
'
'
'Author: Al Musella
'Send comments (Good or Bad) to me at Compuserve: # 76114,637
'############################################################################
'--------------- INITIALIZE ------------------------------
DEFINT A-Z
COLOR 15,1:CLS
DIM L$(200,2) 'holds filenames for ,1-> .pbu ,2 -> .bas
DIM Comp$(200) 'holds names of files to compile
CompCount=0 'Count of items in Comp$
BatchFile$="TMP-MKE.BAT" 'Name of batch file that will compie the ubits
'Erase previous batch file
OPEN BATCHFILE$ FOR OUTPUT AS #3 'have to create one to avoid error on
CLOSE #3 'kill statement
KILL BATCHFILE$
OPEN BATCHFILE$ FOR OUTPUT AS #3 'create batch file with names of files to
'compile
'display title page
PRINT STRING$(79,"*")
PRINT" Make Utility"
PRINT" Version 1.0c"
PRINT" Programmed By : Al Musella"
PRINT STRING$(79,"*")
PRINT
'get name of main file and display it.
FileSpec$=UCASE$(GETFILENAME$) 'function getfilename returns name of project
PRINT
PRINT" Main File: ";FileSpec$
PRINT
'Check if on file - abort if not on file
IF NOT FNFILEEXISTS(FileSpec$) THEN PRINT"This filename is not on file.":_
PRINT"Try running this utility again with valid filename!!!":BEEP:END
'find all $link"*.pbu" files that are involved with this project
GOSUB GETLINKS '-------------------- Gets names of all Linked files into L$()
'check date and time of files
'if no links found, don't waste time checking their dates
IF LinkCount=0 THEN 'This is start of long If statement
PRINT"THERE WERE NO $LINK STATEMENTS IN THIS PROJECT!"
ELSE 'only check dates and times if there are LINKS to compile.
'NOW L$ (,1) HAS ALL FILES LINKED IN AS : *.PBU
GOSUB GETSOURCE 'just changes .PBU to .BAS
PRINT
COLOR 15,1
PRINT"----- UNITS ------------------------------- SOURCE FILES ---------------- ";
'now get name of files that have to be compilied
FOR I = 1 TO LinkCount
IF L$(I,1)<>"" AND L$(I,2)<>"" THEN
COLOR 14,2
PRINT
'Get time and date stamp of files
CALL DTSTAMP$(L$(I,1),DPbu$,TPbu$)
CALL DTSTAMP$(L$(I,2),DBas$,TBas$)
'convert to pseudo julian to compare easier
JPbu#=JULIAN#(DPbu$,TPbu$) 'function julian returns julian date
JBas#=JULIAN#(DBas$,TBas$)
IF JBas#>JPbu# THEN 'if not current, add names to Comp$()
COLOR 0,4
INCR CompCount
Comp$(CompCount)=L$(I,2)
END IF
PRINT L$(I,1);tab(15);DPbu$;" ";TPbu$;tab(40);L$(I,2);tab(55);DBas$;" ";TBas$;
END IF
NEXT I
COLOR 14,1 'yellow/blue
LOCATE 24,1
PRINT
IF CompCount>0 THEN
'add them to batch file
FOR I = 1 TO CompCount
Text$="PBC -CU "+Comp$(I)
PRINT#3,Text$
PRINT "Adding to list: ";Text$
NEXT I
ELSE
PRINT
PRINT"No .Pbu files need to be recompiled"
BEEP
END IF
END IF 'This is the end of IF statement on line 56
'Now add main file to batch file
Exe$=FileSpec$ 'Convert filename to .exe extension
P = INSTR(Exe$,".")
MID$(Exe$,P+1,3) = "EXE"
CALL DTSTAMP$(Exe$,DExe$,TExe$)
CALL DTSTAMP$(FileSpec$,DBas$,TBas$)
Text$="PBC -CE "+FileSpec$
PRINT "Adding to list: ";Text$
PRINT CompCount+1 ;" Files will be compilied"
PRINT
PRINT"--------------------------------------------------------------------------"
PRINT
PRINT"MAIN PROJECT:" FileSpec$,DBas$,TBas$
PRINT"COMPILED :" Exe$,DExe$,TExe$
PRINT
PRINT#3, Text$
CLOSE#3
PRINT:PRINT:PRINT"Executing ";BatchFile$
PRINT
EXECUTE BATCHFILE$ 'do the compiling
END
GETSOURCE: 'Convert .Pbu extension to .Bas for array L$
'Array L$(1 to LinkCount,1) holds .Pbu Filenames
'convert these to .Bas and store in L$(,2)
FOR I = 1 TO LinkCount
FPbu$=L$(I,1) '.Pbu file
'for now, assume .bas - but this can be changed.
'Remove .Pbu , add .bAS
FBas$ = REMOVE$(FPbu$,".PBU")+".BAS"
IF FNFILEEXISTS(FBAS$) THEN
L$(I,2) = FBas$
ELSE
L$(I,2) = ""
L$(I,1) = ""
PRINT"WARNING!!! The source file for ";FPbu$;" is not in"
PRINT"current directory, or doesn't have an extension of .BAS"
PRINT"This file will not be checked!!!"
CALL WAITING
END IF
NEXT I
RETURN
GETLINKS: ' Find all .Pbu files mentioned in the project,
' and store them in array L$(1->LinkCount,1)
'LinkCount is returned as # of files in the array
DIM INCS$(200) 'Hold Included filenames - to search through later
Pointer = 0 'Pointer to next filename in Inc$()
IncCount=0 'Count of Included filenames
LinkCount=0 'Count of Linked filenames
NF$ = FileSpec$ 'NF$ = Next filename to check for more Links
DO WHILE FNFILEEXISTS(NF$)
PRINT"SEARCHING: ";NF$
OPEN NF$ FOR INPUT AS #1
DO WHILE NOT EOF(1)
LINE INPUT #1,T$ '1 line of text from file
IF INSTR(T$,"$") THEN 'Use this to speed it up by only
'checking lines with a $ in them
T$=UCASE$(REMOVE$(T$,ANY CHR$(9,32))) 'Remove tabs and spaces
IF LEFT$(T$,5)="$LINK" AND INSTR(T$,".PBU") THEN
F$=MID$(T$,7,12) 'Isolate filename
QUOTE = INSTR(F$,CHR$(34)) 'Remove quote
IF QUOTE>0 THEN F$=LEFT$(F$,QUOTE-1)
PRINT TAB(10) "FOUND :";F$
INCR LinkCount
L$(LinkCount,1)=F$
END IF
IF LEFT$(T$,8) = "$INCLUDE" THEN
F$=MID$(T$,10,12) 'Isolate filename
QUOTE = INSTR(F$,CHR$(34)) 'Remove quote
IF QUOTE>0 THEN F$=LEFT$(F$,QUOTE-1)
PRINT TAB(10) "FOUND :";F$
IF FNFILEEXISTS(F$) THEN
INCR IncCount
INCS$(IncCount)=F$
ELSE
PRINT"WARNING!! ";F$;" is not in current directory,"
PRINT "and will not be checked!!!":beep:CALL WAITING
END IF
END IF
END IF
LOOP
CLOSE #1
INCR Pointer
NF$=INCS$(Pointer)
LOOP
PRINT"--------------------------------------------------------------------------"
RETURN
$INCLUDE"LibMake.Bas" 'library of functions and subs